<template>
      <div class="el_header_top">
            <div class="zhihu" @click="goIndexx">知乎</div>
            <div class="top_menu">
                <div class="menu_list" v-for="item in menuList" :key="item.name" @click="goIndex(item.name)">
                    {{ item.name }}
                </div>
            </div>
            <div class="top_input">
                <input type="text">
                <img src="@/assets/images/serch.png" alt="">
            </div>
            <div class="button_ques">搜索</div>
            <div class="avant" @click="goPersonal">
                <img src="@/assets/logo.png" alt="">
            </div>
        </div>
</template>
<script>
export default{
    data() {
        return{
            menuList:[
            {name:'首页',index:'1'},
            {name:'等你回答',index:'2'},
            {name:'历史回答',index:'3'},
        ],
    }
},
created(){
    
    console.log(this.menuList );
},
methods:{
    goPersonal(){
        this.$router.push('/personal')
    },
    goIndexx(){
        this.$router.push(
            {
                path:'/',
            }
            )
      },
      goIndex(name){
        if(name == '首页'){
            this.$router.push(
                {
                    path: '/'
                }
            )
        }else if(name == '等你回答'){
            this.$router.push(
                {
                    path: '/',
                    query: {
                        key: '2'
                    }
                }
            )  
       }else if(name == '历史回答'){
            this.$router.push(
                {
                    path: '/',
                    query: {
                        key: '3'
                    }
                }
            )  
       }
      }
}
}
</script>
<style scoped>
.zhihu {
    font-size: 24px;
    font-weight: 700;
    color: rgb(5, 109, 232);
    margin-right: 20px;
}
.zhihu:hover {
    cursor: pointer;
}
.el_header_top,.el_header_bottom {
    display: flex;
    align-items: center;
}
.el_header_top {
    border-bottom: 1px solid #eee;
    margin-bottom: 5px;
    padding-bottom: 5px;
}
.top_menu {
    display: flex;
}
.menu_list:nth-child(2) {
    margin: 0 10px;
}
.menu_list:nth-child(3) {
    margin-right:80px;
}
.menu_list{
    color: #8A95AA;
}
.menu_list:hover {
    cursor: pointer;
    color: #000;
}
.top_menu_left {
    font-size: 20px;
    font-weight: 500;
    margin-right: 50px;
}
.el-menu {
    margin-right: 35px;
}
.top_input {
    position: relative;
    width: 400px;
    height: 30px;
    /* background-color: #415281; */
    border-radius: 40px;

}
.top_input input {
    width: 100%;
    height: 100%;
    outline: none;
    color: #666;
    border: none;
    background-color: #F6F6F6;
    border-radius: 30px;
    padding: 0 42px 0 10px;
    box-sizing: border-box;
    opacity: 1;
}
input:focus {
    outline: none;
 }
.top_input img {
    position: absolute;
    right: 10px;
    top: 0;
    width: 30px;
    height: 30px;
}
.button_ques {
    width: 70px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    color: #78A9E6;
    background-color: #E8EAF0;
    border-radius: 40px;
    margin-left: 30px;
}
.button_ques:hover {
    cursor: pointer;
}
.avant {
    width: 35px;
    height: 35px;
    margin-left: 60px;
}
.avant:hover{
    cursor: pointer;
}
.avant img {
    width: 100%;
    height: 100%;
}
</style>